 //
//  MineViewController.m
//  work
//
//  Created by 方伟 on 16/5/19.
//  Copyright © 2016年 方伟. All rights reserved.
//

#import "MineViewController.h"
#import "SettingViewController.h"       //设置
#import "XHF_SMSLoginViewController.h"  //验证码登陆
#import "PerfectInfoViewController.h"   //临时工人信息完善页面

#import "WorkerInfoModel.h"             //工人信息数据
#import "WorkerUnauditedModel.h"        //审核信息数据

#import "WorkerInfoTableViewCell.h"     //工人信息
#import "CommentInfoTableViewCell.h"    //评价
#import "MoneyInfoTableViewCell.h"      //金钱信息
#import "WorkerCompleteTableViewCell.h" //状态信息(审核成功)
#import "WorkerUnauditedTableViewCell.h"//未审核

#import "TZImagePickerController.h"     //选取相册
#import "WithdrawViewController.h"      //提现
#import "BillViewController.h"          //账单
#import "XHF_LbumViewController.h"      //相册



static NSString *workerInfoTableViewCell_ID = @"WorkerInfoTableViewCell";
static NSString *commentInfoTableViewCell_ID = @"CommentInfoTableViewCell";
static NSString *moneyInfoTableViewCell_ID = @"MoneyInfoTableViewCell";
static NSString *workerCompleteTableViewCell_ID = @"WorkerCompleteTableViewCell";
static NSString *workerUnauditedTableViewCell_ID = @"WorkerUnauditedTableViewCell";




static NSString *collectionViewCell_ID = @"WorkerCompleteCollectionViewCell";

@interface MineViewController ()<
                                 TZImagePickerControllerDelegate,
                                 UITableViewDelegate,
                                 UITableViewDataSource,
                                 WorkerInfoTableViewCellDelegate,
                                 WorkerCompleteTableViewCellDelegate,
                                 WorkerUnauditedTableViewCellDelegate,
                                 MoneyInfoTableViewCellDelegate,
                                 UIActionSheetDelegate,
                                 UINavigationControllerDelegate,
                                 UIImagePickerControllerDelegate,
                                 NetworkToolerDelegate,
                                imageUploadToolDelegate
                                    >

@property (nonatomic, assign) AUDITTYPE audiyType;                     //审核状态
@property (nonatomic, strong) ZhuangxiuManager *zhuangxiuManger;

@property (nonatomic, strong)NSMutableArray *selectedPhotos;           //选中数组
@property (nonatomic, strong)NSMutableArray *selectedAssets;           //选中原图数组
@property (nonatomic, assign)BOOL isSelectOriginalPhoto;               //是否选择原图

@property (nonatomic, strong) WorkerInfoModel *workerInfoModel;        //用户信息数据
@property (nonatomic, strong) WorkerUnauditedModel *workerUnauditedModel; //用户状态数据

@property (nonatomic, strong) UITableView *mineTableView;

@property (strong, nonatomic)NetworkTooler *networkTool;
@property (nonatomic, assign) BOOL isCanClickWorkerCheckin;

@property (nonatomic, strong) TZImageManager   *TZImanagers;
@property (nonatomic ,strong)imageUploadTool *imageuploadtool;
@property (nonatomic, strong) NSMutableArray *imageUpArray;
@property (nonatomic, strong)TZImagePickerController *imagePickerVc;
@property (nonatomic, assign)BOOL isCompletet;               //是否全部上传完毕
@property (nonatomic, assign)int imageIndex;               //上传图片的下标
@property (nonatomic, assign) MINEREQUESSTTYPE requestType;                     //审核状态







@end

@implementation MineViewController


#pragma mark - life cycle
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"个人中心";
    _imageUpArray = [[NSMutableArray alloc]init];

    _workerInfoModel = [WorkerInfoModel new];
    _workerUnauditedModel = [WorkerUnauditedModel new];
    
    self.view.backgroundColor = UIColorFromRGB(0xEBEBEB);
    [self.view addSubview:self.mineTableView];
   
    _networkTool = [NetworkTooler new];
    
    //左
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(0, 0, 30, 30);
    [btn setBackgroundImage:FW_IMAGE(@"set") forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(_nav_leftBTN) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *barBtn = [[UIBarButtonItem alloc] initWithCustomView:btn];
    self.navigationItem.leftBarButtonItem = barBtn;

    
   
    
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.zhuangxiuManger = [ZhuangxiuManager shareManager];

    //判断登录状态
    
    if (!_isCompletet) {
        
        [self judgeLoginState];
    }
    
    if (!_selectedPhotos) {
        
        _selectedPhotos = [NSMutableArray new];
    }
    
    [MobClick beginLogPageView:@"Mine"];//("PageOne"为页面名称，可自定义)

    
}

-(void)viewDidAppear:(BOOL)animated{

    if (_isCompletet) {
        
        [GiabHUD showUIBlockingIndicatorWithText:@"正在上传..."];
        
        
    }
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"Mine"];
}


#pragma mark - Data
//获取用户信息
- (void) _getAuditRequst{
//    self.requestType = MINEREQUESSTTYPEME;
    
    NSDictionary *parameters = @{
                                 @"session_id":self.zhuangxiuManger.sessionid
                                };
    
    _networkTool.delegate = self;
    [_networkTool parameters:parameters withURL:getUserInfo_show withIsPaparameters:YES];
   
    
}

//签到
- (void) _getWorkerCheckinRsqust{
  
    self.requestType = MINEREQUESSTTYPECHECKIN;
  
    NSDictionary *parameters = @{
                                 @"session_id":self.zhuangxiuManger.sessionid
                                 };
    
    _networkTool.delegate = self;
    [_networkTool parameters:parameters withURL:getWorkerCheckin_show withIsPaparameters:YES];
    
}
//上传图片
- (void)uploadConstructPic:(NSString *)pic_url{
    
    self.requestType = MINEREQUESSTTYPEUPIMAGE;

    NSDictionary *parameters = @{
                                 @"session_id":self.zhuangxiuManger.sessionid,
                                 @"pic_url":pic_url
                                 };
    
    [_networkTool parameters:parameters withURL:uploadConstructPic_show withIsPaparameters:YES];
    _networkTool.delegate = self;
    
}

//删除图片
- (void)deleteConstructPic:(NSString *)pic_url{
    
    self.requestType = MINEREQUESSTTYPEDELETEIMAGE;
    
    NSDictionary *parameters = @{
                                 @"session_id":self.zhuangxiuManger.sessionid,
                                 @"pic_url":pic_url
                                 };
    
    [_networkTool parameters:parameters withURL:DeleteConstructPic_show withIsPaparameters:YES];
    _networkTool.delegate = self;
    
}






#pragma mark - UITableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 4;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 2;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 2;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.section) {
        case 0:
            return 150*WID;
            break;
        case 1:
            return 50*WID;
            break;
        case 2:
            return 125*WID;
            break;
        case 3:
            return 250*WID;
            break;
            
        default:
            return 0;
            break;
    }
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.section) {
        case 0:
        {
            WorkerInfoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:workerInfoTableViewCell_ID];
            cell.model = _workerInfoModel;
            cell.delegate = self;
            return cell;
        }
            break;
        case 1:
        {
            CommentInfoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:commentInfoTableViewCell_ID];
            cell.model = _workerInfoModel;
            return cell;
        }
            break;
        case 2:
        {
            MoneyInfoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:moneyInfoTableViewCell_ID];
            cell.model = _workerInfoModel;
            cell.delegate = self;
            return cell;
        }
            break;
        default:
        {
            if ([self.zhuangxiuManger.loginSucceed intValue]>0) {
               return [self showStateCell:tableView audyType:self.audiyType];
            } else {
                
                WorkerUnauditedTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:workerUnauditedTableViewCell_ID];
                cell.delegate = self;
                cell.model = _workerUnauditedModel;
                return cell;
            }
            
        }
            break;
    }
    
    
    
}










#pragma mark - CustomDelegate

//工人信息
- (void)workerInfoBtnWorkerCheckinAction{
    if ([self.zhuangxiuManger.loginSucceed intValue] <= 0) {
        [self showAlertWithTitle:@"温馨提示" message:@"您还没有登录哦!" cancelButtonTitle:@"取消" otherButtonTitles:@"确定"];
        return;
    }
    
    
    //签到结构
    [self _getWorkerCheckinRsqust];
}


//完成图片
- (void)WorkerCompleteCellClick:(NSIndexPath *)index{
    if (_imageUpArray.count>0) {
        [_imageUpArray removeAllObjects];
    }
    [self selectPhotosAction];

}

- (void)WorkerCompleteReturnArray:(NSMutableArray *)array andIndex:(NSInteger)index{
    //弹出相册
    if (array.count == 0 || array.count < index) {
        return;
    } else {
        //进入相册
        XHF_LbumViewController *lbumVC = [[XHF_LbumViewController alloc] init];
        lbumVC.imgArr = array;
//        NSLog(@"%@", array);
        lbumVC.currentIndex = index;
        lbumVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        [self presentViewController:lbumVC animated:YES completion:nil];
    }
}


- (void)returnChangededPhotos:(NSMutableArray *)photos withRemoveImage:(NSString *)imageURL{
    _selectedPhotos = photos;
    
    [self deleteConstructPic:imageURL];
}


- (void)moneyCellPushToNextPageWithtype:(NSInteger)type{
    
    if ([self.zhuangxiuManger.loginSucceed intValue] <= 0) {
        [self showAlertWithTitle:@"温馨提示" message:@"您还没有登录哦!" cancelButtonTitle:@"取消" otherButtonTitles:@"确定"];
        return;
    }
    
    if (_audiyType == AUDITTYPEENOTCONNECT) {
        [self showAlertWithTitle:@"温馨提示" message:@"你的网络有问题哦!" cancelButtonTitle:@"取消" otherButtonTitles:@"确定"];
        return;
    }
    
    
    
    
        
    if (type) {
        
        BillViewController *bill = [BillViewController new];
        bill.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:bill animated:YES];
        
    } else {
        
        if (_workerInfoModel.balacan_cash.integerValue <100) {
            [self showAlertWithTitle:@"温馨提示" message:@"金额小于100元不能提现哦!" cancelButtonTitle:@"取消" otherButtonTitles:@"确定"];
            return;
        }
        
        
        WithdrawViewController *withdraw = [WithdrawViewController new];
        withdraw.userName = _workerInfoModel.real_name;
        withdraw.session_id = self.zhuangxiuManger.sessionid;
        withdraw.maxOutput = _workerInfoModel.balacan_cash;
        withdraw.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:withdraw animated:YES];
    }
}
-(void)reloadUI{
//
//    NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:3];
//    [self.mineTableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
    
    [self.mineTableView reloadData];
}

- (void)functionBtnClick{
    if ([self.zhuangxiuManger.loginSucceed intValue]>0) {
        
        //已登录 获取用户信息 判断审核状态
        switch (self.audiyType) {
                
            case AUDITTYPENO:
            {
                //填写信息
                PerfectInfoViewController *SMSLogin = [PerfectInfoViewController new];
                SMSLogin.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:SMSLogin animated:YES];
                
            }
                break;
                
            case AUDITTYPEING:
                //没有这个按钮
                
                break;
                
            case AUDITTYPEERROR:
            {
                //重新提交信息
                PerfectInfoViewController *SMSLogin = [PerfectInfoViewController new];
                SMSLogin.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:SMSLogin animated:YES];
            }
                
                
                break;
            case AUDITTYPESCUESS:
                
                //没有这个按钮
                
                break;
    
            default:
                //刷新
                [self judgeLoginState];
                break;
        }
        
        
    } else {
        
        
        
        XHF_SMSLoginViewController *SMSLogin = [XHF_SMSLoginViewController new];
        SMSLogin.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:SMSLogin animated:YES];
        
        
    }
}



- (void)returnTextFieldErrorInfo:(NSString *)str{
    [self showAlertWithTitle:@"输入信息有误" message:str cancelButtonTitle:@"取消" otherButtonTitles:@"确定"];
}

#pragma mark - TZImagePickerControllerDelegate

/// 用户选择好了图片，如果assets非空，则用户选择了原图。
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto {
    _isCompletet = YES;

  
    
//    _isSelectOriginalPhoto = isSelectOriginalPhoto;
    
    //区分是否显示了原图
    if (isSelectOriginalPhoto) {
       

        if (!_TZImanagers) {
            
            _TZImanagers = [TZImageManager new];
        }
       
        [_selectedPhotos removeAllObjects];
       
        for (int i = 0; i<assets.count; i++) {
            
            //获取原图
            [ _TZImanagers getOriginalPhotoWithAsset:assets[i] completion:^(UIImage *photo, NSDictionary *info) {
                
                
                if (photo.size.width  >1200) {
                    
                    photo = [photo scaleToSize:photo size:CGSizeMake(1200, 80)];
                }
                
                [_selectedPhotos addObject:photo];
                
                
                
                
            }];
        }
        
        
    }else{
        
        [_selectedPhotos removeAllObjects];
        
        _selectedPhotos = [NSMutableArray  arrayWithArray:photos];
        
        
    }
//    _selectedPhotos = [NSMutableArray arrayWithArray:photos];
//    _selectedAssets = [NSMutableArray arrayWithArray:assets];
//    _isSelectOriginalPhoto = isSelectOriginalPhoto;
    
    
    _imageIndex = 0;
    [self upimageToUpyun:_imageIndex];


    //    _layout.itemCount = _selectedPhotos.count;
    
}

#pragma mark - imageUploadToolDelegate

- (void)returnImageURL:(NSString *)imageURL{
    
    NSLog(@"%@",imageURL)
    
    [_imageUpArray addObject:imageURL];
    [self uploadConstructPic:imageURL];
    
   
    
}
- (void)returnError:(NSString *)error{
    
    [GiabHUD hideUIBlockingIndicator];

    
    [self showAlertWithTitle:@"温馨提示" message:error cancelButtonTitle:@"取消" otherButtonTitles:@"确定"];
}


#pragma mark - NetworkToolerDelegate
- (void)returnData:(id)data{

    if (isNSDictionary) {
      
        
        [_workerInfoModel setValuesForKeysWithDictionary:data];
        self.audiyType = _workerInfoModel.is_verify.intValue;
        NSLog(@"状态值%d", self.audiyType);
        //已登录 获取用户信息 判断审核状态
        switch (self.audiyType) {
            case AUDITTYPENO:
            {
                _workerUnauditedModel.lblMessage = @"没有详细的简历很难接到单子哦!";
                _workerUnauditedModel.btnTitle = @"去填写简历";
                _workerUnauditedModel.hidenBtn = NO;
                [_workerInfoModel cleanInfo];
                [self.mineTableView reloadData];
                break;
            }
                
            case AUDITTYPEING:
            {
                _workerUnauditedModel.lblMessage = @"您的申请已经提交成功,我们将尽快为您审核!";
                _workerUnauditedModel.btnTitle = @"";
                _workerUnauditedModel.hidenBtn = YES;
                [_workerInfoModel cleanInfo];
                [self.mineTableView reloadData];
                break;
            }
            case AUDITTYPEERROR:
            {
                _workerUnauditedModel.lblMessage = [NSString stringWithFormat:@" 提交失败!\n%@",_workerInfoModel.reason];
                _workerUnauditedModel.btnTitle = @"重新提交";
                _workerUnauditedModel.hidenBtn = NO;
                [_workerInfoModel cleanInfo];
                [self.mineTableView reloadData];
                break;
            }
            case AUDITTYPESCUESS:
            {
                
                
                if (self.requestType == MINEREQUESSTTYPEDELETEIMAGE) {
                [GiabHUD showUIBlockingIndicatorWithText:@"删除成功" withTimeout:2.5];
                    self.requestType = MINEREQUESSTTYPEME;
                
            }
                [self.mineTableView reloadData];
                
                if (!_isCompletet) {
                    _imageuploadtool = nil;
                    [GiabHUD hideUIBlockingIndicator];

                    
                }
                
              
                break;
            }
                
            default:
                break;
        }
    
    } else {
       
       
        
        //已登录 获取用户信息 判断审核状态
        switch (self.requestType) {
                
            case MINEREQUESSTTYPEME:
            {
    
                break;
            }
                
            case MINEREQUESSTTYPECHECKIN:
            {
                //签到成功,重新回去个人数据
                [self _getAuditRequst];
             
                break;
            }
            case MINEREQUESSTTYPEUPIMAGE:
            {
                
                 if (_imageUpArray.count == _selectedPhotos.count) {
                    
                    _isCompletet = NO;
                    [self _getAuditRequst];
                
                 }else{
                    
                    
                     
                     if (_imageIndex<_selectedPhotos.count) {
                        _imageIndex++;
                        [self upimageToUpyun:_imageIndex];
                    }
                    
                    
                    
                }

                break;
            }
            case MINEREQUESSTTYPEDELETEIMAGE:
            {
            [self _getAuditRequst];
                break;
            }
                
            default:
                break;
        }
        

        
        
    }
    
}

- (void)returnRequestError:(NSError *)error{
    [GiabHUD hideUIBlockingIndicator];
    
    
}

- (void)returnMsg:(NSString *)Msg{
    [GiabHUD hideUIBlockingIndicator];
    _audiyType = 4;
    _workerUnauditedModel.lblMessage = @"网络连接失败!";
    _workerUnauditedModel.btnTitle = @"点击刷新";
    _workerUnauditedModel.hidenBtn = NO;
    [_workerInfoModel cleanInfo];
    [self.mineTableView reloadData];
    
    [self showAlertWithTitle:@"温馨提示" message:Msg cancelButtonTitle:@"取消" otherButtonTitles:@"确定"];
}







#pragma mark - event response
- (void)_nav_leftBTN{
    SettingViewController *setting = [SettingViewController new];
    setting.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:setting animated:YES];
}






//- (void)deleteBtnClik:(UIButton *)sender {
//    [_selectedPhotos removeObjectAtIndex:sender.tag-1];
//    [_selectedAssets removeObjectAtIndex:sender.tag-1];
//    //    _layout.itemCount = _selectedPhotos.count;
//    
//    [self.collectionViewImages performBatchUpdates:^{
//        NSIndexPath *indexPath = [NSIndexPath indexPathForItem:sender.tag inSection:0];
//        [self.collectionViewImages deleteItemsAtIndexPaths:@[indexPath]];
//    } completion:^(BOOL finished) {
//        [self.collectionViewImages reloadData];
//    }];
//}

-(void)selectPhotosAction{
    
    

    if (_imagePickerVc) {
    
        _imagePickerVc = nil;
    }
        
        _imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:5 delegate:self];
//        _imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto;
        // 在这里设置imagePickerVc的外观
        _imagePickerVc.navigationBar.barTintColor = COLOR_THEHE;
        _imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor];
        _imagePickerVc.oKButtonTitleColorNormal = COLOR_THEHE;
    
    
//    _imagePickerVc.selectedAssets = _selectedAssets; // optional, 可选的
    
    // Set allow picking video & photo & originalPhoto or not
    // 设置是否可以选择视频/图片/原图
    // imagePickerVc.allowPickingVideo = NO;
    // imagePickerVc.allowPickingImage = NO;
    // imagePickerVc.allowPickingOriginalPhoto = NO;
    
    [self presentViewController:_imagePickerVc animated:YES completion:nil];
    
    
}






-(void)upimageToUpyun:(int)i{
  

    if (!_imageuploadtool) {
        _imageuploadtool = [imageUploadTool new];

    }
    

    _imageuploadtool.worker_id  = self.zhuangxiuManger.worker_id ;
    //上传图片
    _imageuploadtool.type = UPLOADIMAGETYPEMINE;
      _imageuploadtool.delegate = self;
    
    
        _imageuploadtool.selectedImage = _selectedPhotos[i];
        _imageuploadtool.index = i;
        [_imageuploadtool uplodImage];
    
}

#pragma mark - private methods
- (void)judgeLoginState{
    

    if ([self.zhuangxiuManger.loginSucceed intValue]>0) {


        [self _getAuditRequst];
        
    } else {
        
        //未登录
        _workerUnauditedModel.lblMessage = @"您还没有登录哦,赶快成为工人!";
        _workerUnauditedModel.btnTitle = @"登录";
        _workerUnauditedModel.hidenBtn = NO;
        [_workerInfoModel cleanInfo];
        [self.mineTableView reloadData];
        
    }
}



- (UITableViewCell *)showStateCell:(UITableView *)tableView audyType:(AUDITTYPE)type{
 
    switch (type) {
        case AUDITTYPESCUESS:
        {
            WorkerCompleteTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:workerCompleteTableViewCell_ID];
            cell.delegate = self;
            if (_workerInfoModel.construct_pic_list.length>0) {
                [_selectedPhotos removeAllObjects];
                NSArray *array = [_workerInfoModel.construct_pic_list componentsSeparatedByString:@","];
                _selectedPhotos = [NSMutableArray arrayWithArray:array];
                cell.selectedPhotos = _selectedPhotos;
            }
            
            return cell;
            
        }
            break;
            
        default:
        {
            WorkerUnauditedTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:workerUnauditedTableViewCell_ID];
            cell.delegate = self;
            cell.model = _workerUnauditedModel;
            return cell;
        }
            break;
    }
}



- (void)btnFunctionAction{
    
    
    if ([self.zhuangxiuManger.loginSucceed intValue]>0) {
        
        //已登录 获取用户信息 判断审核状态
        switch (self.audiyType) {
                
            case AUDITTYPENO:
            {
                //填写信息
                PerfectInfoViewController *SMSLogin = [PerfectInfoViewController new];
                SMSLogin.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:SMSLogin animated:YES];
                
            }
                break;
                
            case AUDITTYPEING:
                //没有这个按钮

                break;
                
            case AUDITTYPEERROR:
            {
                //重新提交信息
                PerfectInfoViewController *SMSLogin = [PerfectInfoViewController new];
                SMSLogin.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:SMSLogin animated:YES];
            }

                
                break;
            case AUDITTYPESCUESS:
                
                //没有这个按钮

                break;
        
            default:
                //刷新
                [self judgeLoginState];
                break;
        }
        
        
    } else {
        

        
        XHF_SMSLoginViewController *SMSLogin = [XHF_SMSLoginViewController new];
        SMSLogin.logintype = LOGINTYPEME;
        SMSLogin.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:SMSLogin animated:YES];
        
        
    }
    
    

}













#pragma mark - gettsers and setters

- (UITableView *)mineTableView{
    if (!_mineTableView) {
        _mineTableView = ({
            UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 64-44) style:UITableViewStyleGrouped];
            
            tableView.delegate = self;
            tableView.dataSource = self;
            
            [tableView registerClass:[WorkerInfoTableViewCell class] forCellReuseIdentifier:workerInfoTableViewCell_ID];
            [tableView registerClass:[CommentInfoTableViewCell class] forCellReuseIdentifier:commentInfoTableViewCell_ID];
            [tableView registerClass:[MoneyInfoTableViewCell class] forCellReuseIdentifier:moneyInfoTableViewCell_ID];
            [tableView registerClass:[WorkerCompleteTableViewCell class] forCellReuseIdentifier:workerCompleteTableViewCell_ID];
            [tableView registerNib:[UINib nibWithNibName:@"WorkerUnauditedTableViewCell" bundle:nil] forCellReuseIdentifier:workerUnauditedTableViewCell_ID];
            tableView.allowsSelection = NO;
            tableView.showsVerticalScrollIndicator = NO;
            tableView;
        });
    }
    return _mineTableView;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
